Skip to main content

Set Bucket Policy

AutomatR.AWS.SetBucketPolicy

The "Set Bucket Policy" activity in AutomatR is part of the AWS S3 activities package, allowing users to set the policy for a specific bucket in Amazon S3. This activity provides flexibility in managing access control to S3 buckets by defining custom policies in JSON format.

Properties

NameDescription
Input
Access Key IDThe encrypted access key ID for your AWS account, enabling connection to the Amazon S3 service. String variables containing the access key ID.
Secret Access KeyThe encrypted secret access key ID for your AWS account, enabling connection to the Amazon S3 service. String variables containing the secret access key.
RegionThe Amazon S3 region where the bucket is located. Choose from a list of available regions. RegionEndpoint variables containing the region information.
Bucket NameThe name of the S3 bucket on which the operation will be performed. String variables containing the bucket name.
Bucket PolicyThe bucket policy to be set, provided as a JSON text in the form of a string variable. This policy defines access control rules for the specified bucket. String variables containing the JSON-formatted bucket policy.
Misc
Display NameProvides a customizable name for the activity displayed in the workflow. The display name enhances clarity and organization within the automation project. String variable or argument containing the desired display name.
Optional
DelayThe amount of time (in seconds) to wait before executing the "Set Bucket Policy" activity. Useful for handling synchronization issues. Integer variables containing the delay duration. Example: If the delay is 1000 milliseconds or 1 sec, set it to 1.

How to use:

  1. Drag and drop the "Set Bucket Policy" activity onto the workflow.
  2. Configure the properties by providing the access key ID, secret access key, region, bucket name, and the desired bucket policy in JSON format.
  3. Optionally, configure the delay for synchronization purposes.
  4. Execute the workflow to set the specified policy for the chosen S3 bucket.

Example: Consider an example where the "Set Bucket Policy" activity is used to apply a custom access policy to an S3 bucket named "example-bucket":

Set Bucket Policy:
Access Key ID: "your-access-key-id"
Secret Access Key: "your-secret-access-key"
Region: RegionEndpoint.USWest2
Bucket Name: "example-bucket"
Bucket Policy: "{ \"Version\": \"2012-10-17\", \"Statement\": [{ \"Effect\": \"Allow\", \"Action\": \"s3:GetObject\", \"Resource\": [\"arn:aws:s3:::example-bucket/*\"] }] }"

In this example, the activity sets an access policy allowing users to retrieve objects from the "example-bucket" in the US West (Oregon) region.